#include <stdlib.h>
#include <stdio.h>
#include "end.h"
#define DEBUG 
extern FILE *yyin;
extern void yylex(void);
extern gdsl_list_t segmentos;

/*
void write_word(const gdsl_element_t element, FILE * file , gdsl_location_t location , void * user_data);


void _write_list(const gdsl_element_t e , FILE * file , gdsl_location_t location , void * user_data){
	if(e != NULL){
		gdsl_list_write(e,&write_word,file,NULL);
	}
}
*/


/*
void write_word(const gdsl_element_t element, FILE * file , gdsl_location_t location , void * user_data){
word aux;
	if(element != NULL){
		aux= ((word)element);
		printf(" word %p\n", aux);
		printf( "termo:  %s\n",aux->termo);
		printf(" f-sin:  %d\n", aux->funcao_sintatica);
		printf(" class:  %d\n", aux->classificacao);
		printf(" relac:  %d\n", aux->relacao);
		printf(" gener:  %d\n", aux->genero);
		printf(" numer:	 %d\n", aux->numero);
		printf(" grau :	 %d\n", aux->grau);
		printf("\n");
	}
}
*/


int main(char argc , char ** argv){
gdsl_list_t lista_palavras;

	lista_palavras = gdsl_list_alloc("palavras",NULL,NULL);
	segmentos = lista_palavras;
	yyin = fopen(argv[1],"r");
	yylex();
	fclose(yyin);
	
	gdsl_list_write(lista_palavras,&_write_list,stdout,NULL);
	printf(" tamanho: %u\n" , gdsl_list_get_size(lista_palavras));
	return 0;
}
